package com.seafood.websocket;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * WebSocket消息DTO
 * 
 * @author System
 * @since 2024-01-01
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WebSocketMessage {
    
    /**
     * 消息发送者
     */
    private String sender;
    
    /**
     * 消息类型
     */
    private String type;
    
    /**
     * 消息内容
     */
    private String content;
    
    /**
     * 消息数据（可选）
     */
    private Object data;
    
    /**
     * 消息时间戳
     */
    private LocalDateTime timestamp;
    
    /**
     * 消息主题（用于订阅）
     */
    private String topic;

    public WebSocketMessage(String sender, String type, String content, Object data) {
        this.sender = sender;
        this.type = type;
        this.content = content;
        this.data = data;
        this.timestamp = LocalDateTime.now();
    }

    public WebSocketMessage(String sender, String type, String content, Object data, String topic) {
        this.sender = sender;
        this.type = type;
        this.content = content;
        this.data = data;
        this.topic = topic;
        this.timestamp = LocalDateTime.now();
    }
}